<?php

use Hyperf\Database\Schema\Schema;
use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Migrations\Migration;

class CreateUsersTable extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('sys_users', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->char('username', 30);
            $table->char('password', 128);
            $table->char('nickname', 60)->nullable()->comment('昵称');
            $table->char('avatar', 225)->nullable()->comment('头像');
            $table->bigInteger('phone')->comment('手机号');
            $table->datetimes();
            $table->unique('username', 'unique_username');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('users');
    }
}
